using Android.App;
using Android.Content;
using ZSoft.PushServices.Net.DTO;

namespace ZSoft.PushServices.Android
{
    public class NotificationFactory
    {
        private Context _ctx;

        public NotificationFactory(Context context)
        {
            this._ctx = context;
        }

        public Notification CreateNew(NotificationDTO dto)
        {
            return this.CreateNew(dto.Title, dto.Message, dto.SmallIcon, dto.LargeIcon);
        }

        public Notification CreateNew(string title, string message, IconDTO smallIcon)
        {
            return this.CreateNew(title, message, smallIcon, null);
        }

        public Notification CreateNew(string title, string message, IconDTO smallIcon, IconDTO largeIcon)
        {
            return Build(title, message, smallIcon, largeIcon);
        }

        private Notification Build(string title, string message, IconDTO smallIcon, IconDTO largeIcon)
        {
            return new Notification.Builder(_ctx)
                        .AddTitle(title)
                            .AddMessage(message)
                                .AddSmalIcon(smallIcon)
                                    .Result.AddLargeIcon(largeIcon)
                                        .Result.Build();
        }
    }
}